package AdminController;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import Dao.AdminDao;

public class AdminIndex implements Controller{

	private AdminDao AdminDao;
	
	public void setAdminDao(AdminDao AdminDao) {
		this.AdminDao = AdminDao;
	}
	
	@Override
	public ModelAndView handleRequest(HttpServletRequest request,
			HttpServletResponse arg1) throws Exception {
		
		System.out.println("어드민 시작");
		
		List<?> list = AdminDao.admin_roomPreview();
		List<?> Yester = AdminDao.YesterCount();
		List<?> Today = AdminDao.TodayCount();
		List<?> Week = AdminDao.WeekCount();
		List<?> Month = AdminDao.MonthCount();
		
		List<?> Count = AdminDao.Count();
		
		ModelAndView mav = new ModelAndView();
		mav.addObject("list",list);
		mav.addObject("Today",Today);
		mav.addObject("Yester",Yester);
		mav.addObject("Week",Week);
		mav.addObject("Month",Month);
		mav.addObject("Count",Count);
		
		mav.setViewName("index");
		
		return mav;
	}
	
}
